
function selectQyxx2(tplcode) {
  ExtElWin2({id: 'selectQyxxWin', title: '选择企业', w: 650, h: 500, tplcode: tplcode});
}

function ExtElWin2(f) {
  var w = 350;
  var h = 160;
  if (f.w) w = f.w;
  if (f.h) h = f.h;
  var qyxxGrid = new Ext.ux.grid.YwGrid({
    //iconCls: 'icon-print',
    region: 'center',
    layout: 'fit',
    tplcode: f.tplcode,
    //margins: '1 1 1 1',
    needSelectTbar: true,
    //needPrintBtn: true,
    url: '/csshljcz-ba!dataList.action',
    keyField: 'id',
    defaultSortField: 'sqrq',
    structure: [{
      name: 'id',
      hidden: true
    },{
      name: 'zzjgdm',
      hidden: true
    },{
      name: 'bgzs',
      hidden: true
    },{
      name: 'frdb',
      hidden: true
    },{
      name: 'yyzzzch',
      hidden: true
    },{
      name: 'lxdh',
      hidden: true
    },{
      name: 'zczb',
      hidden: true
    },{
      name: 'cz',
      hidden: true
    },{
      name: 'email',
      hidden: true
    },{
      name: 'yzbm',
      hidden: true
    },{
      name: 'wtsfj',
      hidden: true
    },{
      name: 'dllxdh',
      hidden: true
    },{
      name: 'dlryddh',
      hidden: true
    },{
      name: 'dlrdzyx',
      hidden: true
    },{
      name: 'qymc',
      header: '企业名称'
    },{
      name: 'fzh',
      header: '证书编号',
      width: 12
    },{
      name: 'fzsjstr',
      header: '发证日期',
      width: 12
    }]
  });
  
  var store = qyxxGrid.store;
  var toolbar = qyxxGrid.toolbar;
  store.on('beforeload', function(){
    store.baseParams = {
      sqdw: toolbar.search_sqdw.getValue()
    };
  }, this);
  
  new Ext.Window({
    id        : f.id,
    title     : f.title,
    width     : w,
    height    : h,
    iconCls   : 'icon_title',
    layout    : 'fit',
    modal     : true,
    plain     : true,
    //autoDestroy : false,
    resizeable: false,
    items     : [qyxxGrid]
  }).show();
}

function selectCallback(params) {
	try{
		setObjvalue(document.forms[0].czid,params.r.get('id'));
		setObjvalue(document.forms[0].zzjgdm,params.r.get('zzjgdm'));
		setObjvalue(document.forms[0].bgzs,params.r.get('bgzs'));
		setObjvalue(document.forms[0].frdb,params.r.get('frdb'));
		setObjvalue(document.forms[0].yyzzzch,params.r.get('yyzzzch'));
		setObjvalue(document.forms[0].lxdh,params.r.get('lxdh'));
		setObjvalue(document.forms[0].zczb,params.r.get('zczb'));
		setObjvalue(document.forms[0].cz,params.r.get('cz'));
		setObjvalue(document.forms[0].email,params.r.get('email'));
		setObjvalue(document.forms[0].yzbm,params.r.get('yzbm'));
		setObjvalue(document.forms[0].wtsfj,params.r.get('wtsfj'));
		setObjvalue(document.forms[0].dllxdh,params.r.get('dllxdh'));
		setObjvalue(document.forms[0].dlryddh,params.r.get('dlryddh'));
		setObjvalue(document.forms[0].dlrdzyx,params.r.get('dlrdzyx'));
		setObjvalue(document.forms[0].qymc,params.r.get('qymc'));
	}catch(e){}
}


function setObjvalue(obj,value){
    if(obj && value)
	   obj.value = value;
	else if(obj)
	   obj.value="";
}